Hi,
I can sort of explain why not the how and certainly not an absolutely certain fix.
Without any links to other devices it is possible to get what seem to be partial logins from the Mac to the iMessages server.
This leads to some iMessages that cannot be sent with no clear reason and also some "missed" incoming items.
There is not way to check your Mac is logged in other than adding someone to a New Message (first likely hurdle) or trying to Send to them (send hurdle).
The first is likely to be met with the name turning Red and claiming they are not "registered" (logged in) with iMessages.
The Second tells you the Message was "not Delivered" with a red exclamation mark.
You can then add to this the confusion about whether syncs appear or not.
Now if you Mac is set to Receive At the Apple ID and the Phone Number you should see those iMessages addressed to both.
However if one is not logged n fully you may only see incoming Messages that were addressed to one of them.
Staying with the Apple ID not logging in from above you may only be seeing items addresses to the iPhone Number.
A Buddy list Chat such as this AIM one between two account I have make it clear.
This is not possible in iMessages form the "To" spot like the picture or by mousing over incoming iMessages.
What you can do is Turn Off or Deselect the Alternatives in the Messages > Preferences > Accounts > iMessages and seeing if it happens with just one option active.
Although the Apple ID has to be logged in you can deselect it as an active Receive At ID
Whilst this may cause more missed item when testing initially it may point more clearly to where the issue is.
The "missing" items should also appear when the deselected ID is turned On again.

8:14 pm Wednesday; April 5, 2017
iMac 2.5Ghz i5 2011 (Sierra)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
iPhone 6 iOS 10.x and an iPad (2)